From b7af187a78bb623c8be4d7f82d5e322702734429 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 29 Jan 2013 20:32:26 -0500 Subject: [PATCH] (bug 33304) Fix ApiQueryAllPages duplicate rows in protection query When querying for protection expiry without also querying protection type(s), DISTINCT is not added to the query. Fix that. Change-Id: I47d3ac1e0cfa6fa1fb0dc0089f5a01698b334cd5 --- RELEASE-NOTES-1.21 | 2 ++ includes/api/ApiQueryAllPages.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 4f38f3a6b5..303e0b0fe9 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -251,6 +251,8 @@ production. an error during parameter validation if the parameter is given but not recognized as an uploaded file. * (bug 44244) prop=info may now return the number of people watching each page. +* (bug 33304) list=allpages will no longer return duplicate entries when + querying protection. === API internal changes in 1.21 === * For debugging only, a new global $wgDebugAPI removes many API restrictions when true. diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 0c6692a3e7..1667a85a4c 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -135,8 +135,6 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } elseif ( $params['prfiltercascade'] == 'noncascading' ) { $this->addWhereFld( 'pr_cascade', 0 ); } - - $this->addOption( 'DISTINCT' ); } $forceNameTitleIndex = false; @@ -146,6 +144,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { $this->addWhere( "pr_expiry != {$db->addQuotes( $db->getInfinity() )}" ); } + $this->addOption( 'DISTINCT' ); + } elseif ( isset( $params['prlevel'] ) ) { $this->dieUsage( 'prlevel may not be used without prtype', 'params' ); } -- 2.20.1